package message_service

import (
	"hytx_media/models"
	"hytx_media/pkg/util"
)

type MsgNum struct {
	Notice     int `json:"notice"`
	Comment    int `json:"comment"`
	Follow     int `json:"follow"`
	Collection int `json:"collection"`
	Share      int `json:"share"`
}

func GetMsgNum(userId int) *MsgNum {
	notice, _ := models.GetMessageCount(userId, 2)
	comment, _ := models.GetMessageCount(userId, 3)
	follow, _ := models.GetMessageCount(userId, 4)
	collection, _ := models.GetMessageCount(userId, 5)
	share, _ := models.GetMessageCount(userId, 6)

	m := &MsgNum{notice, comment, follow, collection, share}
	return m
}

func GetNoticeList(userId int, page int, limit int) ([]*models.MessageResult, *util.Paginate) {
	result, paginate, _ := models.GetNoticeList(userId, page, limit) //列表
	return result, paginate
}

func GetCommentMessageList(userId int, page int, limit int) ([]*models.CommentMessageResult, *util.Paginate) {
	result, paginate, _ := models.GetCommentMessageList(userId, page, limit)
	return result, paginate
}

func GetFollowMessageList(userId int, page int, limit int) ([]*models.FollowMessageResult, *util.Paginate) {
	result, paginate, _ := models.GetFollowMessageList(userId, page, limit)
	return result, paginate
}

func GetCollectionMessageList(userId int, page int, limit int) ([]*models.FAndSMessageResult, *util.Paginate) {
	result, paginate, _ := models.GetFAndSMessageList(userId, page, limit, 5)
	return result, paginate
}

func GetShareMessageList(userId int, page int, limit int) ([]*models.FAndSMessageResult, *util.Paginate) {
	result, paginate, _ := models.GetFAndSMessageList(userId, page, limit, 6)
	return result, paginate
}

func NoticeContent(id int) *models.NoticeMessageContent {
	return models.NoticeContent(id)
}